﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Web;
using System.Web.Mvc;

using Sharp.Portal.Mvc;
using Sharp.Portal.Mvc.Form;
using Sharp.WebBooter.Areas.Demo.Models;
// ReSharper disable Mvc.ViewNotResolved

namespace Sharp.WebBooter.Areas.Demo.Controllers
{
    [Authorize]
    [AutomaticTemplate]
    public class LayoutController : SharpController
    {

        public ActionResult Index()
        {
            var vm = new UserIndexViewModel()
            {
                Layout = new Portal.Mvc.List.SharpList.LayoutInfo()
                {
                    LayoutPath = "../Shared/_Layout.cshtml",
                    SectionName = "tabContent"
                },
                StoreUrlAction = "GetPaged,Tab"
            };
            
           return View(vm);
        }

        public ActionResult Index2()
        {
            var vm = new Tab2ViewModel();
            vm.UI.Layout = new SharpFrom.LayoutInfo()
            {
                LayoutPath = "../Shared/_Layout.cshtml",
                SectionName = "tabContent"
            };
            vm.UI.IsReadOnlyForm = true;
            vm.UI.RefreshUrl = Url.Action("GetData");


            return View(vm);
        }

        public ActionResult GetData(int? id)
        {
            var vm = new Tab2ViewModel();
            vm.UserName = "test";
            vm.Comment = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:ffff");
            vm.UI.IsReadOnlyForm = true;
            vm.UI.RefreshUrl = Url.Action("GetData");

            return View(vm);
        }
    }
}